#include<vector>
#include<iostream>
using namespace std;

class Solution
{
public:
    int maxArea(vector<int>& height)
    {
        int left = 0;
        int right = height.size() - 1;
        int ans = 0;
        int v = 0;
        while (left < right)
        {
            int h = min(height[left], height[right]);
            int l = right - left;
            v = h * l;
            ans = max(v, ans);

            if (height[left] < height[right])
                left++;
            else
                right--;
        }
        return ans;
    }
};